<?php
/**
 *	Autocomplete Facebook Style Plugin
 *	@package autocomplete facebook style
 *	@author Liran Tal <liran.tal@gmail.com>
 *	@license GNU General Public License (GPL) version 2
 *	@copyright (c) Liran Tal of Enginx 2009
 *	@link http://www.enginx.com
 **/


require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");

/*
[
{"caption":"603000|N人民网","value":"603000"},
{"caption":"600543|莫高股份","value":"600543"},
{"caption":"600167|联美控股","value":"600167"},
{"caption":"600862|南通科技","value":"600862"},
{"caption":"600193|创兴资源","value":"600193"},
{}
]
*/

$tag = get_input('tag');

$output = '[';
$securities = get_securities_array($tag);
foreach ($securities as $code=>$name) {
	$output .= "{\"caption\":\"$code $name\",\"value\":\"$code\"},";
}
$output .= '{}]';
echo $output;

